Skip to content

Conversation

krishnangovindraj
Copy link
Member

@krishnangovindraj krishnangovindraj commented Aug 12, 2025

Goal

Document the similarities and differences between 2.x rules and 3.x functions, and explain how they should be equally expressive while being slightly more flexible.

@krishnangovindraj krishnangovindraj force-pushed the document-functions-vs-rules branch from 3abbbcd to 07e70c5 Compare September 10, 2025 17:48
Comment on lines 119 to 124
== Partial evaluation of functions
Although the split between arguments and returned concepts is a reasonable consequence of
having the user think about the computation explicitly, it's less declarative than the rules
where the planner would infer which role-players of a relation should be bound before evaluating the rules.
In the future, we hope to introduce "partial functions" where the planner may choose to leave some
it to the function to bind some of the arguments instead of requiring them as outputs.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd generalize this to "Future functions" to discuss partially bound functions and/or leaving args unbound, both of which would address the need for as many functions right?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But good idea to keep it short like you have

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't decide. I'm calling them contextually bound functions for now.

but it does bring us to the next section.

=== What functions can't do (yet)
To the best of our knowledge, TypeDB in its current state can't do "arbitrarily large" models.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Delete 'best of our knowledge', we should make a claim as we're the experts

Understandable, since this is the case with most programming languages -
but it does bring us to the next section.

=== What functions can't do (yet)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think mentioning turing completeness somewhere here might be good is a relatable way to have it thought about IMO.

Aren't we turing complete if we can generate nats() though?

Copy link
Member Author

@krishnangovindraj krishnangovindraj Sep 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think a push-down automaton might be able to generate nats.

Copy link
Member

@flyingsilverfin flyingsilverfin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved w comments

@krishnangovindraj krishnangovindraj marked this pull request as ready for review September 11, 2025 14:09
@krishnangovindraj krishnangovindraj merged commit 02e9565 into typedb:3.x-development Sep 11, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants